﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using LDSP.BRL;
using BYFW.DAL;

namespace LDSP.Helper
{
    public class EnterpriseFavoriteTreeNodeModifer : TreeNodeModifier
    {
        public EnterpriseFavoriteTreeNodeModifer(int enterpriseID, DocType docType) : base(enterpriseID, docType) { }

        protected override void InitializeCodByCatalog(string cond)
        {
            DataTable result = new Codification().GetRecordsByEnterpriseFavorite(_enterpriseID, cond);

            foreach (DataRow row in result.Rows)
            {
                if (row["catalogID"] != DBNull.Value)
                {
                    int id = Int32.Parse(row["catalogID"].ToString());

                    if (!_codByCatalogDic.ContainsKey(id))
                    {
                        _codByCatalogDic.Add(id, 0);
                    }

                    _codByCatalogDic[id]++;
                }
            }
        }
    }
}